from mediator import mediator
from mediator . tests . test_assistant import make_mediator_test_keyword_args

class gui_fake :
    def __init__ ( self ) :
        self . _gui_create_button_request = None
    def gui_create_button_request ( self , master , text , command , anchor , borderwidth ) :
        self . _gui_create_button_request = [ master , text , command , anchor , borderwidth ]

class mediator_gui_button_tests : 
    'mediator_gui_button'
    def __init__ ( self , test ) :
        self . _test = test
        self . _gui = gui_fake ( )
        self . _mediator = mediator ( )
        self . _mediator . register_modules ( ** make_mediator_test_keyword_args \
            ( 'gui' 
            , self . _gui 
            , None
            ) )
    def test_gui_create_button ( self ) :
        self . _mediator . gui_create_button_request ( 'my master' , 'my text' , 'my command' , 'my anchor' , 'my borderwidth' )
        self . _test . assume_equal ( self . _gui . _gui_create_button_request ,
            [ 'my master'
            , 'my text'
            , 'my command'
            , 'my anchor'
            , 'my borderwidth'
            ] )
    def test_gui_create_button_default_args ( self ) :
        self . _mediator . gui_create_button_request ( 'my master' , 'my text' , 'my command' )
        self . _test . assume_equal ( self . _gui . _gui_create_button_request ,
            [ 'my master'
            , 'my text'
            , 'my command'
            , None
            , None
            ] )
    def test_gui_create_button_named_args ( self ) :
        self . _mediator . gui_create_button_request \
            ( master = 'my master' 
            , text = 'my text' 
            , command = 'my command' 
            , anchor = 'my anchor' 
            , borderwidth = 'my borderwidth'
            )
        self . _test . assume_equal ( self . _gui . _gui_create_button_request ,
            [ 'my master'
            , 'my text'
            , 'my command'
            , 'my anchor'
            , 'my borderwidth'
            ] )
